package com.example.midprojcampusspringboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.midprojcampusspringboot.domain.entity.TManagerClass;
import com.example.midprojcampusspringboot.domain.entity.TTeacherClass;
import com.example.midprojcampusspringboot.domain.entity.TTeachingStudentInClass;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ClassAddStudentsMapper extends BaseMapper<TTeachingStudentInClass> {

    // 批量插入学生的方法
    @Insert({
            "<script>",
            "INSERT INTO t_manager_activity (class_id, student_id, group_id) VALUES ",
            "<foreach collection='list' item='item' index='index' separator=','>",
            "(#{item.classId}, #{item.studentId}, #{item.groupId})",
            "</foreach>",
            "</script>"
    })
    int insertBatch(@Param("list") List<TTeachingStudentInClass> list);

}
